import { delay } from 'roadhog-api-doc';

const mockApi = {
  // siderBar mock
  'GET /mock/mockSidebar': (req, res) => {
    const resDate = {
      code: 200,
      isSuccess: true,
      msg: '操作成功',
      timestamp: 1583415963985,
      data: 'https://dummyimage.com/500x500',
    };
    res.end(JSON.stringify(resDate));
  },

  'POST /mock/login': (req, res) => {
    let resDate = {};
    if (req.body.email === 'admin' && req.body.password === '123456') {
      resDate = {
        code: 200,
        isSuccess: true,
        msg: '登录成功',
        timestamp: 1583415963985,
        data: {
          token: 'admin',
        },
      };
    } else if (
      req.body.email === 'username' &&
      req.body.password === '123456'
    ) {
      resDate = {
        code: 200,
        isSuccess: true,
        msg: '登录成功',
        timestamp: 1583415963985,
        data: {
          token: 'admin',
        },
      };
    } else {
      resDate = {
        code: 200,
        isSuccess: false,
        msg: '账号或者密码错误,请检查',
        timestamp: 1583415963985,
      };
    }
    res.end(JSON.stringify(resDate));
  },

  'POST /mock/product/page': (req, res) => {
    let resDate = {};
    resDate = {
      code: 200,
      isSuccess: true,
      msg: '登录成功',
      timestamp: 1583415963985,
      data: {
        current: 1,
        pageSize: 10,
        data: [
          {
            id: 1,
            serialNumber: 1,
            tradeName: 'PET',
            color: '黑色',
            level: 'A',
            sku: '610 x 0.3',
            unit: '卷',
            price: '含税',
            createTime: '2020年05月05日00:14:22',
            updateTime: '2020年05月05日00:14:22',
          },
        ],
      },
    };
    res.end(JSON.stringify(resDate));
  },

  'POST /mock/order/page': (req, res) => {
    let resDate = {};
    resDate = {
      code: 200,
      isSuccess: true,
      msg: '登录成功',
      timestamp: 1583415963985,
      data: {
        current: 1,
        pageSize: 10,
        data: [
          {
            id: 1,
            b: '20190621120151752120',
            c: 'A公司',
            d: '张三',
            e: '13100000000',
            f: '备注 xxxxxxxxx',
            g: '200000',
            h: '2020年05月05日00:14:22',
            i: '排产中',
            childrenOrder: [
              {
                id: 1,
                b: 'asdasdasdasdasd',
                c: 'PET',
                d: '600 x 500',
                e: '300',
                f: '捆',
                g: 'x公司',
                h: '1 号线',
                i: '排产中',
              },
            ],
          },
        ],
      },
    };
    res.end(JSON.stringify(resDate));
  },

  'POST /mock/productionLineList/page': (req, res) => {
    let resDate = {};
    resDate = {
      code: 200,
      isSuccess: true,
      msg: '登录成功',
      timestamp: 1583415963985,
      data: {
        current: 1,
        pageSize: 10,
        data: [
          {
            id: 1,
            a: 1,
            b: '冠传',
            c: '1 号线',
            d:
              '这是很长很长的备注这是很长很长的备注这是很长很长的备注这是很长很长的备注这是很长很长的备注这是很长很长的备注',
            e: '2020年05月05日00:14:22',
            f: '2020年05月05日00:14:22',
          },
        ],
      },
    };
    res.end(JSON.stringify(resDate));
  },
  'POST /mock/schedulingList/page': (req, res) => {
    let resDate = {};
    resDate = {
      code: 200,
      isSuccess: true,
      msg: '登录成功',
      timestamp: 1583415963985,
      data: {
        current: 1,
        pageSize: 10,
        data: [
          {
            id: 1,
            a: 1,
            b: '冠传',
            c: '1 号线',
            d: '1班',
            e: '张三,李四',
            f: '2020年05月05日00:14:22',
            h: '2020年05月05日00:14:22',
            i: '2020年05月05日00:14:22',
          },
        ],
      },
    };
    res.end(JSON.stringify(resDate));
  },
  'POST /mock/productionScheduling/page': (req, res) => {
    let resDate = {};
    resDate = {
      code: 200,
      isSuccess: true,
      msg: '登录成功',
      timestamp: 1583415963985,
      data: {
        current: 1,
        pageSize: 10,
        data: [
          {
            id: 1,
            a: 1,
            b: '冠传',
            c: '1 号线',
            d: '1班',
            e: 'dd0000000000001',
            f: '2020年05月05日00:14:22',
            h: '20',
            i:
              '长备注长备注长备注长备注长备注长备注长备注长备注长备注长备注长备注长备注长备注长备注长备注',
          },
        ],
      },
    };
    res.end(JSON.stringify(resDate));
  },
  'POST /mock/toProduceManageDetail/page': (req, res) => {
    let resDate = {};
    resDate = {
      code: 200,
      isSuccess: true,
      msg: '登录成功',
      timestamp: 1583415963985,
      data: {
        current: 1,
        pageSize: 10,
        data: [
          {
            id: 1,
            a: 1,
            b: '冠传',
            c: 'xxxxxxxxxxxx',
            d: '1号线',
            e: '橘子',
            f: '600 x 300',
            g: '20',
            h: '201011111',
            i: '30.5kg',
            j: '2020年05月06日',
            k: '2020年05月06日',
          },
        ],
      },
    };
    res.end(JSON.stringify(resDate));
  },
  'POST /mock/deviceDetail/page': (req, res) => {
    let resDate = {};
    resDate = {
      code: 200,
      isSuccess: true,
      msg: '登录成功',
      timestamp: 1583415963985,
      data: {
        current: 1,
        pageSize: 10,
        data: [
          {
            id: 1,
            a: 1,
            b: '冠传',
            c: 'xxx 设备',
            d: '1号线',
            e: '在线',
            f: 'xxx版本',
            g: '信号良好',
            h: '2020年05月06日',
          },
        ],
      },
    };
    res.end(JSON.stringify(resDate));
  },
  'POST /mock/procurementManageDetail/page': (req, res) => {
    let resDate = {};
    resDate = {
      code: 200,
      isSuccess: true,
      msg: '登录成功',
      timestamp: 1583415963985,
      data: {
        current: 1,
        pageSize: 10,
        data: [
          {
            id: 1,
            a: 1,
            b: '原料',
            c: '按公司',
            d: 'pvc',
            e: 'xxx',
            f: '50',
            g: '含税',
            h: '付款公司',
            i: '2020年05月06日',
            j: '汇票',
            k: '200000',
            l: '是',
            m: '2000',
            n: '张三',
          },
        ],
      },
    };
    res.end(JSON.stringify(resDate));
  },
  'POST /mock/inventoryManage/page': (req, res) => {
    let resDate = {};
    resDate = {
      code: 200,
      isSuccess: true,
      msg: '登录成功',
      timestamp: 1583415963985,
      data: {
        current: 1,
        pageSize: 10,
        data: [
          {
            id: 1,
            a: 1,
            b: '原料',
            c: '按公司',
            d: 'pvc',
            e: 'xxx',
            f: '50',
            h: '20000',
            i: '20',
            j: '2020年05月06日',
          },
        ],
      },
    };
    res.end(JSON.stringify(resDate));
  },
  'POST /mock/recipientsDetail/page': (req, res) => {
    let resDate = {};
    resDate = {
      code: 200,
      isSuccess: true,
      msg: '登录成功',
      timestamp: 1583415963985,
      data: {
        current: 1,
        pageSize: 10,
        data: [
          {
            id: 1,
            a: 1,
            b: '原料',
            c: '按公司',
            d: 'pvc',
            e: 'xxx',
            f: '50',
            h: '20000',
            i: '20',
            j: '2020年05月06日',
          },
        ],
      },
    };
    res.end(JSON.stringify(resDate));
  },
  'POST /mock/salesManageDetail/page': (req, res) => {
    let resDate = {};
    resDate = {
      code: 200,
      isSuccess: true,
      msg: '登录成功',
      timestamp: 1583415963985,
      data: {
        current: 1,
        pageSize: 10,
        data: [
          {
            id: 1,
            q: 1,
            w: '原料',
            e: 'xxxxx',
            r: '2020年05月06日',
            t: 'xxx',
            y: 'A',
            u: '50*3',
            i: '20',
            o: '2000',
            p: 'xxx',
            a: 'sss',
            s: 'fff',
            d: 'gg',
            f: 'eee',
            g: 'xxx',
            h: 'dddd',
            j: 'gggg',
          },
        ],
      },
    };
    res.end(JSON.stringify(resDate));
  },
};

export default delay(mockApi, 1000);
